<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
		<title>选择出题</title>
		<link rel="stylesheet" href="__PUBLIC__/css/weui.min.css" />
		<link rel="stylesheet" href="__PUBLIC__/css/example.css" />
		<script src="__PUBLIC__/js/zepto.min.js"></script>
		<script src="__PUBLIC__/js/jquery-weui.js"></script>
		<script src="__PUBLIC__/js/jquery.min.js"></script>
		<script src="__PUBLIC__/js/index.js"></script>
		<style type="text/css">
			.test_img img {
				width: 100%;
				margin: 0;
			}
			
			input {
				float: right;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<div class="weui_cells_title" style="text-align: center;font-size: 18px;">
				选择出题
			</div>
			<div class="weui_panel weui_panel_access">
				<div class="weui_panel_bd">
					<?php if(is_array($QuesItem)): foreach($QuesItem as $key=>$QuesItem): ?><a href="javascript:showQuesAll('showQuesAll',<?php echo ($QuesItem["id"]); ?>);" class="weui_media_box weui_media_appmsg">
							<div class="test_img">
								<?php echo ($key+1); ?>.<input id="<?php echo ($QuesItem["id"]); ?>" type="checkbox" key="key">
								<label style="display: none;"><?php echo ($QuesItem["id"]); ?></label>
								<img src="<?php echo ($QuesItem["questionPicPath"]); echo ($QuesItem["questionPicName"]); ?>" />
							</div>
						</a><?php endforeach; endif; ?>
				</div>
			</div>
		</div>

		<div class="weui_tabbar" style="position: fixed;">
			<a href="javascript:showAllQues('../../submitQues');" class="weui_tabbar_item weui_bar_item_on">
				<div class="weui_tabbar_icon">
					<img src="/gailvlunptSVN/Public/images/icon_nav_msg.png" alt="">
				</div>
				<p class="weui_tabbar_label">已选择题目（<span id="itemchoices">0</span>）</p>
			</a>
		</div>
	</body>

</html>
<script src="__PUBLIC__/js/index.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	//显示已经选择了的题目
	for (var i = 0; i < localStorage.length; i++) {
		if (localStorage.key(i)) {
			$("#" + localStorage.key(i) + "").attr('checked', true);
		}
	}
	var num = $(":checked").length;
	$("#itemchoices").text(num);
	$("input[type='checkbox']").click(function() {
		var num = $(":checked").length;
		$("#itemchoices").text(num);
		questionid = $(this).siblings('label').html();
		//把选择了的数据存在本地;
		if ($(this).is(':checked')) //判断是否选中
			localStorage.setItem(questionid, questionid);
		else
			localStorage.removeItem(questionid, questionid);
	});
</script>